#ifndef EXPDATA_H
#define EXPDATA_H 1

//only used in transparent water stereo image experiment
//response for read in file and write out experiment result
#include "cvxImage.h"
#include <string>
#include <vector>
#include <utility>

#define TYPE_STEREO  0x01
#define TYPE_SQUARE  0x02
#define TYPE_CAUSTIC 0x04


class ExpItem
{
public:
	//input
	int m_idx;
	string m_leftName;
	string m_rightName;
//	string m_normalName;
//	string m_depthName;
	bool m_isStereo;
	bool m_isSquare;
	bool m_isCaustic;
	vector<cv::Point> m_pts;   //patch center position
	vector<char>      m_gt;    //ground truth of peak or valley

	//output
	vector<char>      m_pvResult;
	float             m_correctRatio;
	int               m_type;  //rendering type

public:
	ExpItem();
	~ExpItem();

	void random();   //random the points input
	bool checkResult();

	void read(FILE *pf);
	void write(FILE *pf);

	static bool sparseFile(const string &file, vector<ExpItem> &items);
	static bool saveFile(const string &file, vector<ExpItem> &items);

};



//random both image and positions
class ExpImagePos
{
private:
	vector<ExpItem> m_data;
	int m_curIdx;    //current index

	vector<std::pair<int, int>> m_randomData;  //image index and position index
public:
	ExpImagePos(const string &file);
	~ExpImagePos();

	virtual	void getImages(string &fileA, string &fileB);
	virtual bool nextPos();
	virtual void getCursorPos(int &x, int &y);

	void getConfiguration(bool &isStereo, bool &isSquare, bool &isCaustic, char &pOrv);

	bool recordButton(const char c);

	void saveResult(const string &file = string("result.txt"));

	void GetRestNumber(int &totalNum, int &restNum);

private:
	void randomImagePosition();

	bool checkResult();

};



#endif